package com.zh.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zh.common.QueryPageParam;
import com.zh.common.Result;
import com.zh.entity.Goods;
import com.zh.entity.Record;
import com.zh.entity.recordResult.RecordName;
import com.zh.service.GoodsService;
import com.zh.service.RecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;

import java.util.HashMap;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author zh
 * @since 2025-04-07
 */
@RestController
@RequestMapping("/record")
@Slf4j
public class RecordController {

    @Autowired
    private RecordService recordService;
    @Autowired
    private GoodsService goodsService;

    /**
     * 分页查询
     * 子查询
     * @param queryPageParam
     * @return
     */
    @PostMapping("/listBySubquery")
    public Result listBySubquery(@RequestBody QueryPageParam queryPageParam) {
        return recordService.listBySubquery(queryPageParam);
    }

    /**
     * 添加记录（入库/出库
     * @param record
     * @return
     */
    @PostMapping("/save")
    public Result save(@RequestBody Record record) {
        return recordService.saveRecord(record);
    }

}
